<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<title>订单管理</title>
	<link rel="stylesheet" href="/layui/css/layui.css">
	<link rel="stylesheet" href="/hyqcss/public.css">
	<style type="text/css">
		body{
			background: #e9e9e9;
		}
		/*公共头部带搜索*/
		.public_container{
			margin: 20px;
			background: #fff;
		}
		.public_title_container{
			height: 54px;
			padding: 0 20px;
			font-size: 14px;
			display: flex;
			align-items: center;
			background: #f9f9f9;
			border-bottom: 1px solid #f0f0f0;
		}
		.public_title_container a{
			margin-right: 30px;
			height: 54px;
			line-height: 54px;
			cursor: pointer;
		}
		.public_title_active{
			color: #1E9FFF;
			border-bottom: 1px solid #1E9FFF;
		}
		.public_buttonSearch_container{
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 20px;
			background: #fff;
		}
		.public_buttonSearch_container a{
			color: #fff;
			background-color: #2f54eb;
			text-shadow: 0 -1px 0 rgba(0,0,0,.12);
			height: 24px;
			padding: 4px 15px;
			font-size: 14px;
			border-radius: 2px;
			display: flex;
			align-items: center;
			cursor: pointer;
		}
		.public_Search_container{
			position: relative;
		}
		.public_Search_container input{
			width: 240px;
			height: 32px;
			border: 1px solid #d9d9d9;
		}
		.public_Search_container i{
			position: absolute;
			bottom: 6px;
			right: 10px;
			cursor: pointer;
		}
		/*公共头部带搜索 end*/
		.public_tip_container{
			margin: 20px;
		}
	</style>
</head>
<body>
	<div class="public_tip_container">
		<!-- <button class="layui-btn layui-btn-primary import-file" data-id style="background-color: #1890ff;border: none;color: #ffffff;">导入订单</button> -->
		<span class="layui-btn layui-btn-primary" onclick="copyToClip('{$toolbarUrl}')">复制工具栏URL</span>
	</div>
	<div class="public_container">
		<!-- /*公共头部带搜索*/ -->
		<div class="public_content">
			<div class="public_title_container">
				<a href="javascript::viod(0)">订单列表</a>
				<a href="javascript::viod(0)" class="public_title_active">人人商城订单配置</a>
			</div>
		</div>
		<div class="nav_3 public_table_container" style=" padding-top: 20px;">
	        <div class="layui-form-item">
	            <label class="layui-form-label">数据库ip<span style="color:red;">*</span></label>
	            <div class="layui-input-block">
	                <input type="text" id="database_ip" required lay-verify="required" placeholder="请填写正确的数据库ip" autocomplete="off" class="layui-input" value="{$confing->database_ip}">
	            </div>
	        </div>
	        <div class="layui-form-item">
	            <label class="layui-form-label">数据库名称<span style="color:red;">*</span></label>
	            <div class="layui-input-block">
	                <input type="text" id="database_name" required lay-verify="required" placeholder="请填写正确的数据库名称" autocomplete="off" class="layui-input" value="{$confing->database_name}">
	            </div>
	        </div>
	        <div class="layui-form-item">
	            <label class="layui-form-label">数据库密码<span style="color:red;">*</span></label>
	            <div class="layui-input-block">
	                <input type="text" id="database_pas" required lay-verify="required" placeholder="请填写正确的数据库密码" autocomplete="off" class="layui-input" value="{$confing->database_pas}">
	            </div>
	        </div>
	        <div class="layui-form-item">
	            <label class="layui-form-label">用户名<span style="color:red;">*</span></label>
	            <div class="layui-input-block">
	                <input type="text" id="user_name" required lay-verify="required" placeholder="请填写正确的用户名" autocomplete="off" class="layui-input" value="{$confing->user_name}">
	            </div>
	        </div>
	        <div class="layui-form mt">
	            <label class="layui-form-label">匹配规则<span style="color:red;">*</span></label>
	            <div class="layui-input-block">
		            <input type="radio" name="matching_type"  value="1" title="手机号匹配"{if $confing->matching_type == 1}checked=""{/if}>
		            <input type="radio" name="matching_type"  value="2" title="unionid匹配"  {if $confing->matching_type == 2}checked=""{/if}>
	            </div>
	        </div>
	        <div class="layui-form-item">
	            <div class="layui-input-block">
	                <button class="layui-btn layui-btn-normal" id="update_confing">修改配置</button>
	            </div>
	        </div>
        </div> 
        
	</div>
	</div>
	<script src="/cdn/jquery.js"></script>
	<script src="/layui/layui.js"></script>
	<script type="text/javascript">
		// 弹窗
		layui.use('layer', function(){
			var layer = layui.layer;
		});
		//时间选择器
		layui.use('laydate', function(){
	      var laydate = layui.laydate;

	      //日期范围
	      laydate.render({ elem: '#payTime' ,range: true })
	    })
		// 表单
		layui.use('form', function(){
			var form = layui.form;

		  //监听提交
		  // form.on('submit(orderSelect)', function(data){
		  // 	// layer.msg(JSON.stringify(data.field));
		  // 	// return false;
		  // });

		  	$("button.reset").click(function(){
		  		// $("#orderSelect")[0].reset();
		  		var reset = false;
				$("#orderSelect").find('input[type=text],select').each(function() {
					console.log($(this).val());
					if($(this).val()){
						reset = true;
					}
			        $(this).val('');
			    });
				form.render();
				if(reset){
					location.reload();
				}
				return;
			})
		});

		$('.import-file').on('click',function(){
			let  id = $(this).data('id');
			layer.open({
				type: 2,
				title: '导入订单',
				shadeClose: true,
				shade: 0.2,
				area: ['700px', '450px'],
				content: 'import_order.html?id='+id
			});
		})
	</script>
	<script src="/js/ajax.js"></script>
	<script type="text/javascript">
		$(".public_title_container a").click(function(e){
			if($(this).hasClass('active')) return;
			location.href = 'index.html';
		})

		function copyToClip(content, message) {
			var aux = document.createElement("input"); 
			aux.setAttribute("value", content); 
			document.body.appendChild(aux); 
			aux.select();
			document.execCommand("copy"); 
			document.body.removeChild(aux);
			if (message == null) {
				layer.msg("复制成功");
			} else{
				layer.msg(message);
			}
		}
	</script>

	<script type="text/javascript">
		$("#update_confing").on("click",function(){
			var database_ip = $("#database_ip").val();  
			var database_name = $("#database_name").val();
			var database_pas = $("#database_pas").val(); 
			var user_name = $("#user_name").val();
			var matching_type = $("input:radio:checked").val();
			if(database_ip == "" || database_name == "" || database_pas == "" || user_name == "" || matching_type == ""){
				tusi("必填项不可为空");
				return false;
			}
			myAjaxPost(false, true, 'order_config.html', { matching_type:matching_type,user_name:user_name,database_ip:database_ip,database_name:database_name,database_pas,database_pas}, function (resp) {
				tusi(resp.msg);
			})
		})
	</script>
</body>
</html>